<?php echo $this->fetch('header.html'); ?>
<script type="text/javascript"> 
		function login() {
			var ret_url = $("#ret_url").attr("value");
			var user_name = $("#user_name").val();
			var password = $("#password").val();
			var ca=$("#captcha1").val();
			var captchaEnable = <?php if ($this->_var['captcha']): ?>true<?php else: ?>false<?php endif; ?>;
			if(captchaEnable == false)
			{
				errormsg("为了网站的安全请先开启验证码");
			}
			else
			{
				if(user_name==""){
					errormsg("您必须提供一个用户名");
					return false;
				}else{
					if(password==""){
						errormsg("您必须提供一个密码");
						return false;
					}else{
						if(ca==""){
							 errormsg("请输入右侧图片中的文字");
							 return false;
						 }else{
								var ca_url =REAL_SITE_URL+"/index.php?app=captcha&act=check_captcha";
								$.getJSON(ca_url,{captcha:ca},function(data){
									if(data==false){
										errormsg("验证码错误");
										return false;
									}else{ 
										 var url = REAL_SITE_URL+"/index.php?app=member&act=login";
											$.post(url,{user_name:user_name, password:password},function(data){
												if(data == false){
													 errormsg("您输入的账户名和密码不匹配，请重新输入"); 
													 return false;
												}else{
													msg("登录成功。");
													setTimeout(function(){
														window.location.href=ret_url?unescape(ret_url):REAL_SITE_URL+"/index.php";
													},1500);
												}  
										},"json");
									}
								});
						 }
					}
				}
			}
		}
	</script>
<div id="main" class="pb20">
	<div id="page-auth" class="page-login">
        <dl class="form pb20">
				<dd><input type="text" id="user_name" name="user_name" class="input" placeholder=" 请输入用户名" /></dd>
				<dd><input type="password" name="password" id="password" class="input" placeholder=" 请输入密码" /></dd>
				<?php if ($this->_var['captcha']): ?>
				<dd class="captcha-box">
                    <input type="text" name="captcha" class="input captcha" id="captcha1" placeholder=" 请输入验证码" />
                    <img id="captcha" src="<?php echo $this->_var['site_url']; ?>/mobile/index.php?app=captcha&amp;<?php echo $this->_var['random_number']; ?>" onclick="javascript:change_captcha($('#captcha'));"  /><br />
                </dd>
                <?php endif; ?>
				<input type="button"  onclick="login();" class="enter yahei" value="登录" />                                  
                <input type="hidden" name="ret_url" id="ret_url" value="<?php echo $this->_var['ret_url']; ?>" />
                <p class="mt20">如果您还不是会员，请注册 <a href="<?php echo url('app=member&act=register&ret_url=' . $this->_var['ret_url']. ''); ?>" title="注册">注册</a></p>

        </dl>
       
        <div class="pb20 ml10 partner">
        	<a href="<?php echo $this->_var['site_url']; ?>/mobile/index.php?app=qqconnect&act=login"><img src="<?php echo $this->_var['site_url']; ?>/mobile/static/images/qq.png" /></a>
        	<a href="<?php echo $this->_var['site_url']; ?>/mobile/index.php?app=alipayconnect&act=login"><img src="<?php echo $this->_var['site_url']; ?>/mobile/static/images/alipay.png" /></a>
            <a href="<?php echo $this->_var['site_url']; ?>/mobile/index.php?app=xwbconnect&act=login"><img src="<?php echo $this->_var['site_url']; ?>/mobile/static/images/weibo.png" /></a>
            
        </div>
	</div>
</div>
<?php echo $this->fetch('footer.html'); ?>